//
//  CollectionHeaderView.m
//  EducationAdminClient
//
//  Created by kwsdzjx on 16/9/26.
//  Copyright © 2016年 周佳兴. All rights reserved.
//

#import "CollectionHeaderView.h"
#import "HeaderViewSty1.h"
#import "HeaderViewSty2.h"
#import "Masonry.h"

#define STYLE0 @"0"
#define STYLE1 @"1"
@implementation CollectionHeaderView
-(UIView *)initWithStyle:(NSString *)style andDelegate:(id)delegate andArr:(NSArray *)dataArr{
    
    
    self = [super init];
    if(self){
        _delegate = delegate;
        
        
        
        UIEdgeInsets edge = UIEdgeInsetsMake(0, 0, 0, 0);
        
        
        if ([style isEqualToString:STYLE0]) {
            
            
            HeaderViewSty1 *style1 = [[HeaderViewSty1 alloc]initWithDelegate:_delegate];
            style1.delegate = _delegate;
            [self addSubview:style1];
            
            [style1 mas_makeConstraints:^(MASConstraintMaker *make) {
                make.edges.equalTo(self).insets(edge);
            }];
        }else{
            
            HeaderViewSty2 *style2 = [[HeaderViewSty2 alloc] init];
            [style2 initwithArr:dataArr];
            //            style2.dataArr = dataArr;
            style2.delegate = _delegate;
            [self addSubview:style2];
            
            [style2 mas_makeConstraints:^(MASConstraintMaker *make) {
                make.edges.equalTo(self).insets(edge);
            }];
        }
    }
    return self;
}

/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
 // Drawing code
 }
 */

@end
